Deriving Extract Method Refactoring Suggestions for Long Methods

نویسندگان

  • Roman Haas
  • Benjamin Hummel
چکیده

The extract method is a common way to shorten long methods in software development. Before developers can use tools that support the extract method, they need to invest time in identifying a suitable refactoring candidate. This paper addresses the problem of finding the most appropriate refactoring candidate for long methods written in Java. The approach determines valid refactoring candidates and ranks them using a scoring function that aims to improve readability and reduce code complexity. We use length and nesting reduction as complexity indicators. The number of parameters needed by the candidate influences the score. To suggest candidates that are consistent with the structure of the code, information such as comments and blank lines are also considered by the scoring function. We evaluate our approach to three open source systems using a user study with ten experienced developers. Our results show that they would actually apply 86% of suggestions for an extract method refactoring.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

An Investigation into the Characteristics of Methods for Extract Method Refactoring

“Extract Method” is a refactoring pattern that extracts a part of an existing method as a new method. Although extract method refactoring is an effective way to decompose long and non-cohesive methods in general, how developers choose methods for “Extract Method” refactoring is still unexamined. For supporting this refactoring, the investigation of it is neccessary. In this study, we investigat...

متن کامل

Identifying Extract Method Opportunities Based on Variable References (S)

Long methods are usually difficult to read and comprehend due to the length and complexity of the code. As a result, maintenance can be time consuming and costly. One strategy to lower overall cost of software development for large systems is to produce smaller and less complex methods through method refactoring. This paper presents a new technique to automate the selection process of program f...

متن کامل

From Pair Programming to Mob Programming to Mob Architecting

Software Development and Quality Assurance From Agile Development to DevOps: Going Towards Faster Releases at High Quality – Experiences from an Industrial Context . . . . . . . . . . . . . . . . 33 Frank Elberzhager, Taslim Arif, Matthias Naab, Inge Süß, and Sener Koban Learning to Rank Extract Method Refactoring Suggestions for Long Methods. . . . . . . . . . . . . . . . . . . . . . . . . . ....

متن کامل

Identification of extract method refactoring opportunities for the decomposition of methods

The extraction of a code fragment into a separate method is one of the most widely performed refactoring activities, since it allows the decomposition of large and complex methods and can be used in combination with other code transformations for fixing a variety of design problems. Despite the significance of Extract Method refactoring towards code quality improvement, there is limited support...

متن کامل

JExtract: An Eclipse Plug-in for Recommending Automated Extract Method Refactorings

Although Extract Method is a key refactoring for improving program comprehension, refactoring tools for such purpose are often underused. To address this shortcoming, we present JExtract, a recommendation system based on structural similarity that identifies Extract Method refactoring opportunities that are directly automated by IDE-based refactoring tools. Our evaluation suggests that JExtract...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2016